home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Sample.bin / ContrastMetalTheme.java < prev    next >
Text File  |  1998-06-30  |  4KB  |  91 lines

  1. /*
  2.  * @(#)ContrastMetalTheme.java    1.8 98/03/06
  3.  * 
  4.  * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  */
  20.  
  21. import com.sun.java.swing.plaf.*;
  22. import com.sun.java.swing.plaf.basic.*;
  23. import com.sun.java.swing.plaf.metal.*;
  24. import com.sun.java.swing.*;
  25. import com.sun.java.swing.border.*;
  26. import java.awt.*;
  27.  
  28. /**
  29.  * This class describes a higher-contrast Metal Theme.
  30.  *
  31.  * @version 1.8 03/06/98
  32.  * @author Michael C. Albers
  33.  */
  34.  
  35. public class ContrastMetalTheme extends DefaultMetalTheme {
  36.  
  37.     public String getName() { return "Contrast"; }
  38.  
  39.     private final ColorUIResource primary1 = new ColorUIResource(0, 0, 0);
  40.     private final ColorUIResource primary2 = new ColorUIResource(204, 204, 204);
  41.     private final ColorUIResource primary3 = new ColorUIResource(255, 255, 255);
  42.     private final ColorUIResource primaryHighlight = new ColorUIResource(102,102,102);
  43.  
  44.     private final ColorUIResource secondary2 = new ColorUIResource(204, 204, 204);
  45.     private final ColorUIResource secondary3 = new ColorUIResource(255, 255, 255);
  46.     private final ColorUIResource controlHighlight = new ColorUIResource(102,102,102);
  47.  
  48.     protected ColorUIResource getPrimary1() { return primary1; } 
  49.     protected ColorUIResource getPrimary2() { return primary2; }
  50.     protected ColorUIResource getPrimary3() { return primary3; }
  51.     public ColorUIResource getPrimaryControlHighlight() { return primaryHighlight;}
  52.  
  53.     protected ColorUIResource getSecondary2() { return secondary2; }
  54.     protected ColorUIResource getSecondary3() { return secondary3; }
  55.     public ColorUIResource getControlHighlight() { return super.getSecondary3(); }
  56.  
  57.     public ColorUIResource getFocusColor() { return getBlack(); }
  58.  
  59.     public ColorUIResource getTextHighlightColor() { return getBlack(); }
  60.     public ColorUIResource getHighlightedTextColor() { return getWhite(); }
  61.   
  62.     public ColorUIResource getMenuSelectedBackground() { return getBlack(); }
  63.     public ColorUIResource getMenuSelectedForeground() { return getWhite(); }
  64.     public ColorUIResource getAcceleratorForeground() { return getBlack(); }
  65.     public ColorUIResource getAcceleratorSelectedForeground() { return getWhite(); }
  66.  
  67.  
  68.     public void addCustomEntriesToTable(UIDefaults table) {
  69.  
  70.         Border blackLineBorder = new BorderUIResource(new LineBorder( getBlack() ));
  71.         Border whiteLineBorder = new BorderUIResource(new LineBorder( getWhite() ));
  72.  
  73.     Object textBorder = new BorderUIResource( new CompoundBorder(
  74.                                blackLineBorder,
  75.                                    BasicMarginBorder.getMarginBorder()));
  76.  
  77.         table.put( "ToolTip.border", blackLineBorder);
  78.     table.put( "TitledBorder.border", blackLineBorder);
  79.         table.put( "Table.focusCellHighlightBorder", whiteLineBorder);
  80.         table.put( "Table.focusCellForeground", getWhite());
  81.  
  82.         table.put( "TextField.border", textBorder);
  83.         table.put( "PasswordField.border", textBorder);
  84.         table.put( "TextArea.border", textBorder);
  85.         table.put( "TextPane.font", textBorder);
  86.  
  87.  
  88.     }
  89.  
  90. }
  91.